n=int(input())
not_safe_list=[]
whole_list=[i for i in range(1,n+1)]
i=1     #i为查找的洞口号
step=2
for _ in range(1000):
    for j in range(step):
        i+=1
        if i>n:
            i=1
    step+=1
    not_safe_list.append(i)
not_safe_list = list(set(not_safe_list))
if len(not_safe_list)!=len(whole_list):
    for k in whole_list:
        if k not in not_safe_list:
            print(k)
else:
    print('0')